#!/usr/bin/perl

##########################################################################
##                                                                       #
## This file is part of the DogosFrame distribution.  For full copyright #
## information, see COPYRIGHT and COPYING.LESSER.                        #
##                                                                       #
## Author:           sqbang                                              #
## Email:            sqbang@ustc.edu                                     #
## Date:             2013.12.11                                          #
## Acknowledegments: This file is a copy from SAMRAI projection          #
##                   with slight modification.                           #
## Description:      Script in input database package.                   #
##                                                                       #
##########################################################################

while(<>) {
    s/^#line.*//;
    s/.*Revision:.*//;
    s/.*Date:.*//;
    s/.*Header:.*//;

    s/#include <unistd.h>/#ifdef DOGOS_HAVE_UNISTD_H\n#include <unistd.h>\n#endif/;

    # substitution to replace [yylval] with DOGOS_[yylval]
    s/yylval/DOGOS_yylval/g;

    s/YY_DO_BEFORE_ACTION;/YY_DO_BEFORE_ACTION/;
    s/^(\s)+;$/$1do {} while(0);/;

    s/#if YY_STACK_USED/#ifdef YY_STACK_USED/;
    s/#if YY_ALWAYS_INTERACTIVE/#ifdef YY_ALWAYS_INTERACTIVE/;
    s/#if YY_MAIN/#ifdef YY_MAIN/;

    print $_;
}
